package com.bdweb.service.impl;


import com.bdweb.dao.powerDao;
import com.bdweb.model.POWER;
import com.bdweb.service.PowerService;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.stereotype.Service;

import java.util.List;

@Service

public class PowerServiceImpl implements PowerService {
    @Autowired
    private powerDao powerdao;
    @Override
    public List<POWER> findAllPower() {
        return powerdao.findAll();
    }

    @Override
    public POWER findPower(String powerName, boolean isopen ,String ip ,String port,String codeopen,String codeclose) {
        return powerdao.findByNameAndPwd(powerName,isopen,ip,port,codeopen,codeclose);
    }

    @Override
    public Integer addPower(POWER user) {
        return powerdao.addByPower(user);
    }

    @Override
    public Integer deletePower(Integer id) {
        return powerdao.deletePowerById(id);
    }

    @Override
    public Integer updatePowerInfo(Integer id, String powerName, boolean isopen,String ip ,String port,String codeopen,String codeclose) {
        return powerdao.updateNameAndPwdById(id,powerName,isopen,ip,port,codeopen,codeclose);
    }


}
